import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-06-30
 * Time: 9:35
 */
public class Test {
    public static void main(String[] args) {
        int[] arry = {1,2,34,3,4,5,7,23,12};
        boolean ret = oddNumber(arry);
        System.out.println(ret);
    }
    public static boolean oddNumber(int[] arry){
        int count = 0;
        for (int i = 0; i < arry.length; i++) {
            if(arry[i] % 2 != 0){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                return true;
            }
        }
        return false;
    }


    public static void main5(String[] args) {
        int[] arry = {2,2,1,1,1,2,2};
        bubbleSort(arry);
        System.out.println(arry[arry.length / 2]);
    }
    public static void main4(String[] args) {
        int[] arry = {4,1,2,1,2};
        int sum = 0;
        for (int i = 0; i < arry.length; i++) {
            sum ^= arry[i];
        }
        System.out.println(sum);
    }
    public static int[] nums(int[] arry,int key){
        int[] ret = new int[2];
        for (int i = 0; i < arry.length-1; i++) {
            for (int j = i+1; j <arry.length ; j++) {
                if(arry[i] + arry[j] == key){
                    ret[0] = i;
                    ret[1] = j;
                }
            }
        }
        return ret;
    }
    public static void main3(String[] args) {
        int[] arry = {2,7,11,15,8,12};
        int[] ret = nums(arry,14);
        for (int x:ret) {
            System.out.println(x+" ");
        }
    }
    public static void main2(String[] args) {
        int[] arry = {1,2,9,4,12,6,15,3};
        bubbleSort(arry);
        for (int x:arry) {
            System.out.print(x+" ");
        }
    }
    public static void bubbleSort(int[] arry){
        boolean flg = false;
        for (int i = 0; i < arry.length-1; i++) {
            for (int j = 0; j < arry.length-1-i; j++) {
                if(arry[j] > arry[j+1]){
                    int tmp = arry[j];
                    arry[j] = arry[j+1];
                    arry[j+1] = tmp;
                    flg = true;
                }
            }
            if(flg == false){
                break;
            }
        }
    }
    public static int binarySearch(int[] arry,int key){
        int left =0;
        int right = arry.length - 1;
        while (left <= right){
            int m = (left+right) / 2;
            if(arry[m] < key){
                left = m + 1;
            } else if(arry[m] > key) {
                right = m -1;
            }else{
                return m;
            }
        }
        return -1;
    }
    public static void func(int[] arry){
        int i = 0;
        int j = arry.length-1;
        while (i < j){
            while (i < j && arry[i] % 2 != 0){
                i++;
            }
            while (i < j && arry[j] % 2 == 0){
                j--;
            }
            int tmp = arry[i];
            arry[i] = arry[j];
            arry[j] = tmp;
        }
    }
    public static void main1(String[] args) {
        int[] arry = {1,2,3,4,5};
        func(arry);
       // System.out.println(Arrays.toString(arry));
        for (int x: arry) {
            System.out.print(x+" ");
        }
    }
}
